<template>
    <view class="smart-page">
        <view class="smart-page-head">
            <view calss="smart-page-head-title">输入控件</view>
        </view>
        <view>
            <view>可自动获取焦点</view>
            <view><input class="smart-input" focus="true" placeholder="请输入手机号"></input></view>
        </view>
        <view>
            <view>右下角显示搜索</view>
            <view><input class="smart-input" confirm-type="search" placeholder="输入要搜索的内容"></input></view>
        </view>
        <view>
            <view>控制最大输入长度</view>
            <view><input class="smart-input" maxlength="5" confirm-type="search" placeholder="请输入内容"></input></view>
        </view>
        <view>
            <view>密码输入</view>
            <view><input class="smart-input" password="true" confirm-type="search" placeholder="请输入内容"></input></view>
        </view>
        <view>
            <view>可查看密码</view>
            <view class="wrapper">
                <input class="smart-input" :password="showPassword" placeholder="请输入密码"></input>
                <image class="eye" src="../../../static/eye.png" @click="changePassword()"></image>
            </view>
        </view>
        <view>
            <view>同步获取</view>
            <view><input class="smart-input" @input="onKeyInput"></input></view>
            <view><text>{{inputValue}}</text></view>
        </view>
    </view>
</template>

<script>
    export default{
        data(){
            return {
                showPassword:true,
                inputValue:''
            }
        },
        methods:{
            changePassword(){
                console.log('click...')
                this.showPassword = !this.showPassword;
            }
            onKeyInput(e){
                console.log(e.detail.value);
                this.inputValue = e.detail.value
            }
        }
    }
</script>